package com.zh.sharding.sale.repository;

import com.zh.sharding.sale.entity.MyOrders;
import com.zh.sharding.sale.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author ZH
 * @date 09:24 2023/8/4
 */
@Mapper
public interface UserDao {
    String TABLE_NAME = "t_user";

    @Insert("insert into t_user(username,phone,card_number,create_time) " +
            " values(#{username},#{phone},#{cardNumber},#{createTime})")
    int insert(User user);

    @Select("select * from t_user where id=#{id}")
    User selectById(@Param("id") long id);

    @Select("select * from t_user where username=#{username} limit 1")
    User selectByUsername(@Param("username") String username);

    @Select("select * from t_user where phone=#{phone} limit 1")
    User selectByPhone(@Param("phone") String phone);

}
